package com.thirdgroup.controller;

import com.thirdgroup.controller.base.BaseServlet;
import com.thirdgroup.pojo.BusinessCustomerIndustry;
import com.thirdgroup.service.BusinessIndustryService;
import com.thirdgroup.service.impl.BusinessIndustryServiceImpl;
import com.thirdgroup.utils.respond.R;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @BelongsProject: gxa-thrid-team
 * @BelongsPackage: com.thirdgroup.controller
 * @Author: ZYS
 * @CreateTime: 2024-05-08  11:42
 * @Description: TODO
 */
@WebServlet(name = "BusinessIndustryServlet",urlPatterns = "/businessIndustry/*")
public class BusinessIndustryServlet extends BaseServlet {
    private static final BusinessIndustryService  businessIndustryService = new BusinessIndustryServiceImpl();
    //向前端返回所有行业信息
    public Object getAllBusinessIndustry(HttpServletRequest request, HttpServletResponse response) {
        List<BusinessCustomerIndustry> allBusinessIndustry = businessIndustryService.getAllBusinessIndustry();
        if (allBusinessIndustry.size() == 0) {
            return R.ok(null, "暂无行业信息");
        }else {
            return R.ok(allBusinessIndustry);
        }
    }
}
